package jrain.fw.core.business;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

 
/**
 * <pre>
 * 作者：3244924214@qq.com 
 * 描述： 业务请求
 * </pre>
 */
public class BusinessRequest implements Serializable {

	private static final long serialVersionUID = 1L;

	/**
	 * 服务名称
	 */
	private String service;

	/**
	 * 服务方法
	 */
	private String method;

	/**
	 * 请求数据
	 */
	private Map<String, Object> data = new HashMap<String, Object>();

	/**
	 * 扩展数据
	 */
	private Map<String, Object> extData = new HashMap<String, Object>();

	public BusinessRequest() {

	}

	public BusinessRequest(String service, String method) {
		this.service = service;
		this.method = method;
	}

	// 服务 -------------------------------------------------------------
	public void setService(String service) {
		this.service = service;
	}

	public String getService() {
		return service;
	}

	public void setMethod(String method) {
		this.method = method;
	}

	public String getMethod() {
		return method;
	}

	public String getKey() {
		return service + "." + method;
	}
	// 请求 -------------------------------------------------------------

	public Map<String, Object> getData() {
		return data;
	}

	public void setData(Map<String, Object> data) {
		this.data = data;
	}

	public void putData(String key, Object value) {
		data.put(key, value);
	}

	public Object getData(String key) {
		return data.get(key);
	}

	public void clearData() {
		data.clear();
	}

	// 扩展 -------------------------------------------------------------
	public void setExtData(Map<String, Object> extData) {
		this.extData = extData;
	}

	public void putExtData(String key, Object value) {
		extData.put(key, value);
	}

	public Map<String, Object> getExtData() {
		return extData;
	}

	public Object getExtData(String key) {
		return extData.get(key);
	}

	public void clearExtData() {
		extData.clear();
	}

}
